function Animal (name) {
    this.name = name;
}

Animal.prototype.sayHi = function () {
    console.log('hi, my name is ' + this.name);
};

function Dog (type, name) {
    Animal.call(this, name); // extends(1) + super
    this.type = type;
}

// extends(2)
Dog.prototype = Object.assign(Dog.prototype, Animal.prototype);

Dog.prototype.sayWangWang = function () {
    console.log('wangwang');
};

const dog = new Dog('二哈', '嘿嘿');
dog.sayHi(); // hi, my name is 嘿嘿
